import 'dart:convert';

UserInfoModel userInfoModelFromJson(String str) => UserInfoModel.fromJson(json.decode(str));

String userInfoModelToJson(UserInfoModel data) => json.encode(data.toJson());

class UserInfoModel {
  int code;
  String ? message;
  UserInfoData ? data;

  UserInfoModel({
    required this.code,
    this.message,
    this.data,
  });

  factory UserInfoModel.fromJson(Map<String, dynamic> json) => UserInfoModel(
    code: json["code"],
    message: json["message"],
    data: json["data"] != null ? UserInfoData.fromJson(json["data"]) : null,
  );

  Map<String, dynamic> toJson() => {
    "code": code,
    "message": message,
    "data": data?.toJson(),
  };
}

class UserInfoData {
  int id;
  String username;
  String password;
  String? phone;
  String? email;
  String nickname;
  int point;
  String avatar;
  int gender;
  String description;
  int vip;
  int role;
  String createDate;

  UserInfoData({
    required this.id,
    required this.username,
    required this.password,
    this.phone,
    this.email,
    required this.nickname,
    required this.point,
    required this.avatar,
    required this.gender,
    required this.description,
    required this.vip,
    required this.role,
    required this.createDate
  });

  factory UserInfoData.fromJson(Map<String, dynamic> json) => UserInfoData(
    id: json["id"],
    username: json["username"],
    password: json["password"],
    phone: json["phone"],
    email: json["email"],
    nickname: json["nickname"],
    point: json["point"],
    avatar: json["avatar"],
    gender: json["gender"],
    description: json["description"],
    vip: json["vip"],
    role: json["role"],
    createDate: json["createDate"]
  );

  Map<String, dynamic> toJson() => {
    "id": id,
    "username": username,
    "password": password,
    "phone": phone,
    "email": email,
    "nickname": nickname,
    "point": point,
    "avatar": avatar,
    "gender": gender,
    "description": description,
    "vip": vip,
    "role": role,
    "createDate": createDate
  };
}
